import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import { Item } from '../../models/item';
import { Items } from '../../providers/providers';

@Component({
  selector: 'page-contacts',
  templateUrl: 'contacts.html'
})
export class ContactsPage {
  currentItems: any = [];

  constructor(public navCtrl: NavController, public items: Items) {
  }


  getItems(ev) {
    console.log(123);
    let val = ev.target.value;
    console.log(val);
    if (!val || !val.trim()) {
      this.currentItems = [];
      return;
    }
    this.currentItems = this.items.query({
      name: val
    });
  }
}
